import Vue from 'vue'
import Router from 'vue-router'

Vue.use(Router)
const Air = () => import('../components/air')

const Home = () => import('../components/home/home')
const Login = () => import('../components/login/login')

const Announcement = () => import('../components/home/announcement/announcement')
const AnnounContent = () => import('../components/home/announcement/announContent')
const Delegate = () => import('../components/home/delegate/delegate')
const ConfirmDeta = () => import('../components/home/delegate/children/children/confirmDeta')

//忘记密码
const ForgetPass = () => import('../components/login/ForgetPass')
const NewPass = () => import('../components/login/newPass')

//个人中心
const Personal = () => import('../components/personal/personal')
const Protocol = () => import('../components/personal/children/protocol')
const Receipt = () => import('../components/home/delegate/receipt/ReceiptInfo.vue')

//修改密码
const passEdit = () => import('../components/personal/children/passEdit/passEdit')

//交易记录
const trding = () => import('../components/personal/children/trding/trding')
const purch = () => import('../components/personal/children/trding/children/purchaser')
const seller = () => import('../components/personal/children/trding/children/seller')
const Transaction = () => import('../components/home/transaction/transaction') //交易大厅

//资产管理
const remind = () => import('../components/personal/children/remind')

const custom = () => import('../components/personal/children/custom/custom')
const customService = () => import('../components/personal/children/custom/customService')
const customOrders = () => import('../components/personal/children/custom/customOrders')
const customContact = () => import('../components/personal/children/custom/customContact')

const Updata = () => import('../components/updata.vue')

export default new Router({
	// mode: 'history',
	routes: [
		{
			path: '/',
			redirect: '/home'
		},
		{
			path:'/updata',
			component: Updata
		},
		{
			path:'/login/:checked?',
			component: Login,
		},
		{
			path:'/newPass',
			component: NewPass
		},
		{
			path:'/forgetPass/:status?',
			component: ForgetPass
		},
		{
			path:'/home',
			component: Home,
			children:[
				{
					path:'announcement',
					component: Announcement,
					children:[
						{
							path:'announContent/:id?',
							component: AnnounContent
						}
					]
				},
				{
					path:'transaction',
					component: Transaction,
					meta:{ title:'交易大厅' }
				},
				{
					path:'delegate/:status?',
					component: Delegate,
					children:[
						{
							path:'confirmDeta/:id?/:status?',
							component: ConfirmDeta
						}
					]
				}
			]
		},
		{
			path:'/personal',
			component: Personal,
			children:[
				{
					path:'protocol',
					component: Protocol
				},
				{
					path:'receipt/:isReturn?',
					component: Receipt
				},
				{
					path:'trding',
					component:Air,
					children:[
						{
							path:'',
							component:trding,
							meta:{ title:'交易记录' }
						},
						{
							path:'purchaser/:id?',
							component:purch,
							meta:{ title:'我的买单' }
						},
						{
							path:'seller/:id?',
							component:seller,
							meta:{ title:'我的卖单' }
						}
					]
				},
				//密码修改
				{
					path:'passEdit',
					component: passEdit,
					meta:{ title: '密码修改' },
					children:[
						{
							path:''
						}
					]
				},

				//资产管理
				{
					path:'remind',
					component:remind,
				},
				//联系客服
				{
					path:'custom',
					component:custom,
					children:[
						{
							path:'customService',
							component:customService,
						},
						{
							path:'customOrders',
							component:customOrders,
						},{
							path:'customContact',
							component:customContact,
						},
					]
				}

			]
		}
	]
})
